$(function(){
    $("#btnGuardar").click(function(){

        var jsondata = "([";
        for (i = 1; i < 8; i++) {
            var dia = document.getElementById("tablaHorario").rows[i].cells[0].innerHTML;
            for (j= 1; j < 14; j++) {
                var hora = document.getElementById("tablaHorario").rows[0].cells[j].innerHTML;
                var checked = document.getElementById("tablaHorario").rows[i].cells[j].firstChild.checked
                var valor = 0;
                if(checked)
                    valor = 1;
                jsondata += "{dia:'" + dia + "',hora:'" + hora + "',valor:'" + valor + "'},";
            }
        }
    jsondata += "])";
    var params = "datos=" + jsondata + "&action=MHorario";
        $.ajax({
           data:params,
           type:"POST",
           url:"AdminRedireccion.php",
           dataType:"json",
           success:function(data){
               alert(data.mensaje);
           }
        });
    });
});